<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>for...in遍历对象的属性</title>
	</head>
	<body>
	</body>
	<script>
		var books = [];
		books.push("ac"); 
		books[4] = '张三';
		/*此处的i表示数组元素*/
		for( i in books){
			console.log(i)
			console.log(books[i]);
		}
		alert(books.length)
		
		var person= {
			uname:'张四',
			age:20,
			speak : function(){
				console.log('speak');
			}
		}
		/*此处的i表示对象的属性*/
		for(i in person){
			console.log(i);
			console.log(person[i]);
		}
	</script>
</html>
